package com.lc.luzhengtang.adapter;

import android.view.ViewGroup;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lc.luzhengtang.R;
import com.lc.luzhengtang.bean.RecordBean;
import com.zcx.helper.scale.ScaleScreenHelperFactory;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * 文 件 名: NewsListAdapter
 * 创 建 人: zhangyu
 * 创建日期: 16/12/24 19:55
 * 邮   箱: yuanchong121@gmail.com
 * 修改时间：
 * 修改备注：
 */
public class WithDrawListAdapter extends BaseQuickAdapter<RecordBean.DataBeanX.DataBean, BaseViewHolder> {
    private String status;

    public WithDrawListAdapter(List<RecordBean.DataBeanX.DataBean> data) {

        super(R.layout.item_withdraw, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, RecordBean.DataBeanX.DataBean item) {
        ScaleScreenHelperFactory.getInstance().loadView((ViewGroup) helper.convertView);
        long time = item.getCreate_time();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String date = sdf.format(new Date(time*1000L));

        Date date2=null;
        SimpleDateFormat formatter=new SimpleDateFormat("yyyy-MM-dd");
        try {
            date2=formatter.parse(date);

            String time2=formatter.format(date2);
            helper.setText(R.id.text_time,time2);

        } catch (ParseException e) {
            e.printStackTrace();
        }



        helper.setText(R.id.text_money, "¥" + item.getMoney());

        if (item.getTypes() == 1) {
            helper.setText(R.id.text_type, "银联");
        } else if (item.getTypes() == 2) {
            helper.setText(R.id.text_type, "支付宝");
        } else {
            helper.setText(R.id.text_type, "微信");

        }

        if (item.getStatus() == 0) {
            helper.setText(R.id.text_status, "申请中");
        } else if (item.getStatus() == 1) {
            helper.setText(R.id.text_status, "完成");
        } else {
            helper.setText(R.id.text_status, "拒绝");
        }

    }

}
